package entity;

import java.util.TimeZone;

/**
 * Values and methods for specifying the TZID property
 * for the iCalendar object as defined in RFFC 5545. This 
 * property specifies the "VTIMEZONE" calendar component
 * in the scope of an iCalendar object. 
 * 
 * @author Sean Young
 * @version 1.0
 *
 */
public class TimeZoneIdentifier {
        /** The parameters for the TZID property */
        private String tzidpropparam;
        
        /** The value of the TZID property*/
        private String tzid;
        
        /**
         * The default constructor for the TimeZoneIdentifier 
         * property. The Time Zone is defaulted to the Time Zone 
         * defined by TimeZone.getDefault().
         */
        public TimeZoneIdentifier() {
                TimeZone findTD = TimeZone.getDefault();
                
                this.tzidpropparam = null;
                this.tzid = findTD.getID();
        }
        
        
        /**
         * Sets the value of the TZID parameter field. 
         * @param value The TZID (Time Zone Identifier)
         */
        
        public void setTZIDPropParam(String value) {
                this.tzidpropparam = null;
        }
        
        /**
         * Sets the value of the TZID property
         * @param tzid The Time Zone Identifier
         */
        public void setTzid(String tzid) {
                this.tzid = tzid;
        }
        
        public String getTZID() {
        	return tzid;
        }
        
        /**
         * Returns a string containing the values of the fields of the
         * TZID property. If no parameters were specified then they 
         * will not be included.
         */
        public String toString() {
                StringBuilder prioString = new StringBuilder("TZID");
                
                if(tzidpropparam != null) prioString.append(tzidpropparam);
                
                prioString.append(":");
                
                prioString.append(tzid);
                prioString.append("\r\n");
                
                return prioString.toString();
        }
        

}
